#include<iostream>
#include"commend.hpp"

int main()
{
    int wfd=open("pipe",O_WRONLY);
    if(wfd==-1)
    {
        perror("open");
        return 1;
    }
    while(true)
    {
        string str;
        cout<<"Please enter the message to be sent:";
        getline(cin,str);
        if(str=="quit"||str=="q")
        {
            break;
        }
        else 
        {
            ssize_t ret=write(wfd,str.c_str(),str.size());
            if(ret==-1)
            {
                perror("write");
                break;
            }
        }
    }
    return 0;
}